package cn.itcast.service.cargo.impl;

import cn.itcast.dao.cargo.ShipOrderDao;
import cn.itcast.domain.cargo.ShipOrder;
import cn.itcast.domain.cargo.ShipOrderExample;
import cn.itcast.service.cargo.ShipOrderService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.UUID;

@Service
public class ShipOrderServiceImpl implements ShipOrderService {
    @Autowired
    private ShipOrderDao shipOrderDao;
    @Override
    public List<ShipOrder> findByShipTime(String shipTime) {
        return null;
    }

    //分页
    @Override
    public PageInfo<ShipOrder> findByPage(ShipOrderExample shipOrderExample, int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        //查询页面数据
        List<ShipOrder> list = shipOrderDao.selectByExample(shipOrderExample);
        return new PageInfo<>(list);
    }

    @Override
    public List<ShipOrder> findAll(ShipOrderExample shipOrderExample) {
        return null;
    }

    @Override
    public ShipOrder findById(String id) {
        return null;
    }

    @Override
    public void save(ShipOrder shipOrder) {
        //设置委托单的基本id
        shipOrder.setShippingOrderId(UUID.randomUUID().toString());
        //保存数据
        shipOrderDao.insertSelective(shipOrder);


    }

    @Override
    public void update(ShipOrder shipOrder) {

    }

    @Override
    public void delete(String id) {

    }
}
